import random
import string
import arrow
import captcha
from captcha.image import ImageCaptcha
from flask import Blueprint, request, redirect, make_response, Response
from application.models.model import User
from cache import my_cache
from db_init import db
from swaager_init import siwa, BaseModel
from sqlalchemy.exc import IntegrityError
from flask_login import login_user, login_required,current_user

from tools.data_tools import orm2dict

back = siwa.blueprint("back", __name__)


@back.route("/vip", methods=['GET'])
def vip_reload():
    day = arrow.now().int_timestamp
    User.query.filter(User.end_t.__lt__(day)).update({'vip':0})
    db.session.commit()
    return {"code": 206, 'msg': '账号已存在', 'data': {}}
